﻿using Dapper;
using System.Data;
using System.Threading.Tasks;

namespace lwzlz.Core.Repository
{
    /// <summary>
    /// 默认仓储接口实现局部类 Insert
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public partial class Repository<TEntity>
    {
        public int? Insert(TEntity entity, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.Insert(entity, transaction, commandTimeout);
        }

        public int? Insert<T>(T entity, IDbTransaction transaction = null, int? commandTimeout = default(int?)) where T : ModelBase, new()
        {
            return dbconn.Insert(entity, transaction, commandTimeout);
        }

        public Task<int?> InsertAsync(TEntity entity, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.InsertAsync(entity, transaction, commandTimeout);
        }
    }
}
